﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Wix.Aura.Common.CustomTypes;

namespace Wix.Aura.Common {
	public class ProgId : IXmlSerializable {
		private ProgId() { }
		private ProgId(string id) {
			Id = id;	
		}

		public ProgId(string id, ICollection<ProgId> progid) : this(id) {
			ProgIdCollection = progid;
		}

		public ProgId(string id, ICollection<Extension> extension) : this(id){
			Extension = extension;
		}

		public string Id { get; set; }
		public YesNoType Advertise { get; set; }
		public string Description { get; set; }
		public string Icon { get; set; }
		public int? IconIndex { get; set; }
		public string NoOpen { get; set; }

		public ICollection<ProgId> ProgIdCollection { get; private set; }
		public ICollection<Extension> Extension { get; private set; }


		public System.Xml.Schema.XmlSchema GetSchema() {
			throw new NotImplementedException();
		}

		public void ReadXml(System.Xml.XmlReader reader) {
			throw new NotImplementedException();
		}

		public void WriteXml(System.Xml.XmlWriter writer) {
			writer.WriteStartElement("ProgId");
			writer.WriteAttribute("Id", Id);
			writer.WriteAttribute("Advertise", Advertise);
			writer.WriteAttribute("Description", Description);
			writer.WriteAttribute("Icon", Icon);
			writer.WriteAttribute("IconIndex", IconIndex);
			writer.WriteAttribute("NoOpen", NoOpen);
			if (ProgIdCollection != null)
				writer.WriteElements(ProgIdCollection);
			if (Extension != null)
				writer.WriteElements(Extension);
			writer.WriteEndElement();
		}
	}
}
